package stream;

import java.util.Objects;

public class Book {
    private String name;
    private int score;

    public Book() {
    }

    public Book(String name, int score) {
        this.name = name;
        this.score = score;
    }

    /**
     * 获取
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取
     * @return score
     */
    public int getScore() {
        return score;
    }

    /**
     * 设置
     * @param score
     */
    public void setScore(int score) {
        this.score = score;
    }

    public String toString() {
        return "Book{name = " + name + ", score = " + score + "}";
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Book book = (Book) o;
        return score == book.score && Objects.equals(name, book.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, score);
    }
}
